﻿<Window x:Class="ResourceBlender.Express.WinAutoTranslate"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:loc="clr-namespace:ResourceBlender.Express"
    loc:WindowService.EscapeClosesWindow="True"
    Title="Automatic Translation" WindowStartupLocation="CenterOwner"
    MinHeight="550" Height="650" MinWidth="400" Width="600"
    Style="{StaticResource {x:Type Window}}" Icon="/ResourceBlenderExpress;component/Resources/images/resourceblender.ico">
    <Window.CommandBindings>
        <CommandBinding Command="ApplicationCommands.Close" Executed="CloseWindow" />
        <CommandBinding Command="ApplicationCommands.Help" Executed="ShowHelp" />
        <CommandBinding Command="loc:ResourceBlenderCommands.AutoTranslate" Executed="AutoTranslate" />
    </Window.CommandBindings>
    <DockPanel LastChildFill="True">
        <StatusBar DockPanel.Dock="Bottom" Height="24">
            <StatusBarItem x:Name="lblStatus" Visibility="Collapsed">Loading</StatusBarItem>
            <StatusBarItem>
                <ProgressBar x:Name="prgStatus" IsIndeterminate="True" Visibility="Hidden" />
            </StatusBarItem>
        </StatusBar>
        <Grid DockPanel.Dock="Top" Margin="6">
            <Grid.RowDefinitions>
                <RowDefinition Height="*" MinHeight="190" />
                <RowDefinition Height="*" />
                <RowDefinition Height="*" />
                <RowDefinition Height="Auto" MinHeight="80" />
                <RowDefinition Height="Auto" MinHeight="20" />
            </Grid.RowDefinitions>

            <GroupBox x:Name="grpItemsToTranslate" Grid.Row="0" Header="Items To Translate">
                <loc:ApplicationSelector x:Name="appSelector" Mode="SingleApplicationBundles" PropertyChanged="AppSelector_PropertyChanged" />
            </GroupBox>

            <GroupBox Grid.Row="1" Header="Source Language" VerticalAlignment="Stretch">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="2*" />
                        <ColumnDefinition Width="2*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <Label Grid.Row="0" Grid.Column="0">Translate From</Label>
                    <ListBox x:Name="lstSourceLanguage" Grid.Row="1" Grid.Column="0" SelectionChanged="LanguageSelected" ItemTemplate="{StaticResource LanguageListItem}" 
                             SelectionMode="Single" SelectedValuePath="Key" ItemsSource="{Binding ElementName=appSelector,Path=SelectedLanguages}" />

                    <Label Grid.Row="0" Grid.Column="1">Treat As</Label>
                    <ListBox x:Name="lstSourceType" Grid.Row="1" Grid.Column="1" 
                             SelectionMode="Single" DisplayMemberPath="Value" SelectedValuePath="Key" />
                </Grid>
            </GroupBox>

            <GroupBox Grid.Row="2" Header="Destination Language" VerticalAlignment="Stretch">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="2*" />
                        <ColumnDefinition Width="2*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>

                    <Label Grid.Row="0" Grid.Column="0">Fill Translations For</Label>
                    <ListBox x:Name="lstDestinationLanguage" Grid.Row="1" Grid.Column="0" SelectionChanged="LanguageSelected" ItemTemplate="{StaticResource LanguageListItem}" 
                             SelectionMode="Single" SelectedValuePath="Key" ItemsSource="{Binding ElementName=appSelector,Path=SelectedLanguages}" />

                    <Label Grid.Row="0" Grid.Column="1">Treat As</Label>
                    <ListBox x:Name="lstDestinationType" Grid.Row="1" Grid.Column="1"
                             SelectionMode="Single" DisplayMemberPath="Value" SelectedValuePath="Key" />
                </Grid>
            </GroupBox>

            <GroupBox Grid.Row="3" Header="Options">
                <StackPanel>
                    <Label>If a translation into the destination language already exists</Label>
                    <RadioButton x:Name="radLeave" IsChecked="True">Leave the existing translation</RadioButton>
                    <RadioButton x:Name="radOverwrite">Overwrite the translation with the machine translation</RadioButton>

                    <CheckBox x:Name="chkVerbose" IsChecked="True">Show translated text during translation</CheckBox>
                </StackPanel>
            </GroupBox>

            <Grid Grid.Row="4" VerticalAlignment="Center">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="15" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                
                <loc:ImageButton x:Uid="loc:ImageButton_1" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" MinWidth="70" Command="ApplicationCommands.Help" Image="pack://application:,,,/Resources/images/question_16.png" ImageLocation="Left" Text="Help" />
                <TextBlock Grid.Row="0" Grid.Column="1" ToolTip="Automatic translation powered by Google">Powered By</TextBlock>
                <Image Grid.Row="1" Grid.Column="1" Source="pack://application:,,,/Resources/images/google_small.png" Stretch="None" ToolTip="Automatic translation powered by Google" />
                <Button Grid.Row="0" Grid.Column="3" Grid.RowSpan="2" MinWidth="140" Command="loc:ResourceBlenderCommands.AutoTranslate" IsDefault="True">Translate Resources</Button>
            </Grid>
        </Grid>
    </DockPanel>
</Window>
